package edu.sctu.xiangkun.day201506.day20150607.TextOne;

import java.text.DateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 * Created by user21 on 2015/6/7.
 */
public class DateTime {
    Calendar calendar = Calendar.getInstance();
    Date date = new Date();
    DateFormat dateFormat = DateFormat.
            getDateTimeInstance(DateFormat.LONG, DateFormat.LONG);

    public void setDateTime(){
        date.getTime();
        System.out.println("时间戳："+date.getTime()+"毫秒");

        calendar.set(calendar.YEAR, 2014);
        calendar.set(calendar.MONTH,5);
        calendar.set(calendar.DATE,11);
        calendar.set(calendar.HOUR_OF_DAY,9);
        calendar.set(calendar.MINUTE,30);
        calendar.set(calendar.SECOND,10);
        Date date1 = calendar.getTime();
        System.out.println("相遇时间："+dateFormat.format(date1));
        date1.getTime();
        System.out.println("相遇时间距离现在"+date1.getTime()+"毫秒");
    }
}
